Feature: Check items available to add to shopping cart
Description: As user I want to check if I could add to shopping cart any searched item.
File name: amazon_test.feature
Relative path: features/amazon_test.feature
Scenario Outline: Perform a seach for iPhone 14 PRO and add it to the shopping cart
Before
Hook
00:00:00.004
And
I click on search button
00:00:02.431
org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"#add\-to\-cart\-button"}
(Session info: chrome=111.0.5563.111)
For documentation on this error, please visit: https://selenium.dev/exceptions/#no_such_element
Build info: version: '4.8.1', revision: '8ebccac989'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '19'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [5d5e600830159cad69e66e56d0005288, findElement {using=id, value=add-to-cart-button}]
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 111.0.5563.111, chrome: {chromedriverVersion: 111.0.5563.64 (c710e93d5b63..., userDataDir: C:\Users\PEDRO~1.GIR\AppDat...}, goog:chromeOptions: {debuggerAddress: localhost:56520}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: WINDOWS, proxy: Proxy(), se:cdp: ws://localhost:56520/devtoo..., se:cdpVersion: 111.0.5563.111, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true}
Session ID: 5d5e600830159cad69e66e56d0005288
at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:67)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:484)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:200)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:133)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:53)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:184)
at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:167)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:142)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
at org.openqa.selenium.remote.ElementLocation$ElementFinder$2.findElement(ElementLocation.java:162)
at org.openqa.selenium.remote.ElementLocation.findElement(ElementLocation.java:60)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:352)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:344)
at actions.BrowserActions.isWebElementDisplayed(BrowserActions.java:52)
at stepdefinitions.Tests.tryToAddTheItemToShoppingCart(Tests.java:90)
at ✽.I see the description and add the item to shopping cart(file:///C:/Users/pedro.giron01/Desktop/Repo/Automation_Portfolio/Web_Automation/verify_items/src/test/java/features/amazon_test.feature:13)
Then
I see the confirmation message
0s
And
I see the cart items count is "1"
0s
Scenario Outline: Perform a seach for QA Automation book and add it to the shopping cart
Before
Hook
0s
And
I click on search button
00:00:01.666
org.junit.ComparisonFailure: expected:([2]) but was:([1]) at org.junit.Assert.assertEquals(Assert.java:117) at org.junit.Assert.assertEquals(Assert.java:146) at stepdefinitions.Tests.seeTheCartItemsCountIncreasing(Tests.java:109) at ✽.I see the cart items count is "2"(file:///C:/Users/pedro.giron01/Desktop/Repo/Automation_Portfolio/Web_Automation/verify_items/src/test/java/features/amazon_test.feature:15)